<?php
set_include_path('/alidata/www/xinjieco/auto/');

require_once "class/mysql_connect.php";
require_once "class/function_curl.php";
require_once "class/function_cutwords.php";
require_once "class/water.php";
require_once "class/cutphoto.php";

require_once "class/function_html2ubb.php";
require_once "class/function_savedata.php";


set_time_limit(0);
$time = time();
$now_day = date(Ymd);
$is_aid = 0;



$viewres = mysql_fetch_array(mysql_query("SELECT t1.*, t2.fid,type FROM cdb_xinjieco_auto_list t1, cdb_xinjieco_auto_listres t2 
										WHERE t1.status = '0' AND t1.fid = t2.fid AND t2.type = 'huanqiu' ORDER BY id LIMIT 1"));

if ($viewres) {


	$fid = $viewres[fid];

	$outpage = $viewres[res];

	$page_res = get_url($outpage);

	//匹配操作

	$title = str_substr('<h1>', '</h1>', $page_res);

	$content = str_substr("<div class=\"text\" id=\"text\">", "<!-- 翻页按钮 begin -->", $page_res);


	/*
	数据过滤 ...
	*/




	$title = strtr_words($title);

	$content = strtr_words($content);

	$content = html2ubb($content, $fid);

	$title = trim(strip_tags($title));

	if ($title && $content) {
		//数据入库
		$msg = save_data(($title), trim(addslashes($content)), $fid, '1', $is_aid);
	}else{
		$msg = " —— $viewres[id]数据为空，跳过<br/>";
	}

	mysql_query("UPDATE cdb_xinjieco_auto_list SET status = '1' WHERE id = '$viewres[id]'");


	echo $msg;


}



